<?php
include_once("login.php");

	$conn = mysqli_connect($dbhost,$dbuser,$dbpass,$db)
		or die("SQL connect error: ".mysqli_connect_error());
	
	$username = $_GET['username'];
	mysqli_real_escape_string($conn,$username);
	$quizname = $_GET['quizname'];
	mysqli_real_escape_string($conn,$quizname);
	
	$stmt = mysqli_prepare($conn, "Select score FROM scores WHERE username = ? AND quizname = ?");
	mysqli_stmt_bind_param($stmt,"ss", $username, $quizname);
	
	mysqli_stmt_execute($stmt);
	
	mysqli_stmt_store_result($stmt);
	
	$score = null;
	mysqli_stmt_bind_result($stmt,$score);

	mysqli_stmt_fetch($stmt)
	or die('Error on fetch' . mysqli_connect_error());

	print $score;

	mysqli_stmt_close($stmt);
	mysqli_close($conn);
	

?>
